<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    
  </style>
</head>
<body>
  
</body>
<script>

  const obj = {
    name:"admin",
    age:18,
    sex:"女"
  }

  // 解构赋值时的默认值
  const { name, age, sex="" } = obj;

  console.log(name);
  console.log(age);
  console.log(sex);


  // 函数的参数的默认值
  function createZero( n=0 ){
    if(n < 10){
      return "0" + n;
    }else{
      return n;
    }
  }

  console.log(createZero(  ));
  console.log(createZero( 5 ));
  console.log(createZero( 15 ));




  


</script>
</html>